package com.sean.designpatterns.structure.filter;

import java.util.List;

public class AndCriteria implements Criteria {

    private Criteria criteria;
    private Criteria othercriteria;

    public AndCriteria(Criteria criteria, Criteria othercriteria) {
        this.criteria = criteria;
        this.othercriteria = othercriteria;
    }

    @Override
    public List<Person> meetCriteria(List<Person> personList) {
        List<Person> one = criteria.meetCriteria(personList);
        return othercriteria.meetCriteria(one);
    }
}
